package com.yape.stockService.impl;

import com.yape.dao.IHsgtFundFlowDao;
import com.yape.po.HsgtFundFlow;
import com.yape.stockService.IHsgtFundFlowService;
import com.yape.vo.HsgtFundFlowVO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author zmele
 * @description
 * @date 2025/5/25 14:09
 */
@Service
public class HsgtFundFlowService implements IHsgtFundFlowService {

    @Resource
    private IHsgtFundFlowDao hsgtFundFlowDao;

    @Override
    public List<HsgtFundFlowVO> queryHsgtFundFlow() {
        List<HsgtFundFlow> hsgtFundFlow = hsgtFundFlowDao.queryHsgtFoundFlow();


        List<HsgtFundFlowVO> hsgtFundFlowVOList = hsgtFundFlow.stream()
                .map(e -> HsgtFundFlowVO.builder()
                        .id(e.getId())
                        .boardName(e.getBoardName())
                        .totalTurnover(e.getTotalTurnover())
                        .netBuyAmount(e.getNetBuyAmount())
                        .build())
                .toList();

        return hsgtFundFlowVOList;
    }
}